(function($){
	$(function(){
		/************登录*************/
		var userName=getCookie('username');
		if(userName!=''){
			$('#login').html('欢迎您！ '+userName+' <a href="javascript:;"> [ 退出  ] </a>');
			$('#login a').click(function(){
				$('#login').html('嘿，欢迎来顺丰优选！<a href="login.html">请登录 </a><a href="reg.html"> 免费注册</a>')
			});
		}
		$('.menu').mouseenter(function(){
			$('.main_nav').css('display','block');
		}).mouseleave(function(){
			$('.main_nav').css('display','none');
		});
		$('.big_menu').mouseenter(function(){
			$('.main_nav').css('display','block');
		}).mouseleave(function(){
			$('.main_nav').css('display','none');
		});
		/***********购物车链接************/
		$('.slide_shop').click(function(){
			var newWin=window.open('car.html');
		});
		/**********购物车数量**********/
		var goodMess=getCookie('mess');
		if(goodMess==''||goodMess==null){
			$('.hover02').text(0);
		}else{
			var arr=JSON.parse(goodMess);
			$('.hover02').text(arr.length);
			if($('.hover02').text()!='0'){
				$('.shop_car').click(function(){
					window.open('car.html');
				});
			}
		}
		$('.slide_common').eq(0).mouseover(function(){
			var goodMess=getCookie('mess');
			if(goodMess==''||goodMess==null){
				$('.shop_car_list').css('display','block');
			}else{
				$('.shop_car_list').css('display','none');
			}
		});
		$('.slide_common').eq(0).click(function(){
			var goodMess=getCookie('mess');
			if(goodMess==''||goodMess==null){
				$('.shop_car_list').css('display','block');
			}else{
				window.open('car.html');
			}
		});
		
		function getCookie(name){
			var str=document.cookie;
			var arr=str.split("; ");
			for(var i=0;i<arr.length;i++){
				var address=arr[i].indexOf("=");
				var name1=arr[i].slice(0,address);
				var value=arr[i].slice(address+1,arr[i].length);
				if(name==name1){
					return value;
				}
			}
			return "";
		}	
	});
})(jQuery);
